<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>diyReact</title>
</head>
<body>
  <div id="opr">
    <label><input name="demo" type="radio" value="stage0-base"/>基本</label>
    <label><input name="demo" type="radio" value="stage1-composite"/>复杂组件</label>
    <label><input name="demo" type="radio" value="stage2-update"/>更新组件</label><br/>
    <label><input name="demo" type="radio" value="stage3-domdiff"/>domDiff</label>
    <label><input name="demo" type="radio" value="stage4-transaction"/>transaction</label>
    <label><input name="demo" type="radio" value="qReact"/>qReact</label>
  </div>
  <div id="root"></div>
  <script>
    const myWorker = new Worker('./tools/worker.js');
    const root = document.getElementById('root');
    document.getElementById('opr').addEventListener('click',function(e){
      const {name , value} = e.target;
      if(name === 'demo'){
        root.innerHTML = '刷新ing';
        myWorker.postMessage([value]);
        myWorker.onmessage = function(e) {
          root.innerHTML = '';
          eval(e.data);
        }
      }
    })
  </script>
</body>
</html>